<template>
  <el-icon :title="currIcon?.title" color="var(--el-color-primary)">
    <component :is="currIcon?.component"></component>
  </el-icon>
</template>

<script setup name="DefaultIcon">
const { oid } = defineProps({
  oid: {
    type: String,
    default: '',
    required: true,
  },
});
const icons = [
  { type: 'WTDocument', component: 'Document', title: '文档' },
  { type: 'EPMDocument', component: 'Document', title: 'CAD文档' },
  { type: 'WTPart', component: 'Setting', title: '部件' },
  { type: 'folder', component: 'Folder', title: '文件夹' },
];
const currIcon = computed(() => {
  return icons.find((item) => oid.includes(item.type));
});
</script>

<style lang="less" scoped></style>
